-- Viral Resistance - T-Engine 4 Module
-- Copyright (C) 2010 Mikolai Fajer
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
--
-- Mikolai Fajer "yufra"
-- mfajer@gmail.com

newTalent{
	name = "Stealth Leap",
	message = "@Source@ leaps into the darkness.",
	type = {"utility/stealth", 1},
	points = 5,
	cooldown = 10,
	action = function(self, t)
		if not self:isTalentActive(self.T_STEALTH) then
			-- Activate stealth
			local old_hide_chance = self.hide_chance
			self.hide_chance = 100
			local old = self.energy.value
			self.energy.value = 100000
			self:useTalent(self.T_STEALTH)
			self.energy.value = old
			self.changed = true
			self.hide_chance = old_hide_chance
		end
		
		-- And "teleport"
		self:teleportRandom(self.x, self.y, 5, 3)
	end,
	info = function(self, t)
		return ([[Activates T_STEALTH and teleports.]])
	end,
}